package com.lsl.controller;

import com.lsl.entity.Song;
import com.lsl.entity.Result;
import com.lsl.service.MusicService;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/music-service")
public class MusicController {

    @Autowired
    private MusicService musicService;

    @GetMapping("/song/{id}")
    public Result<Song> getSongById(@PathVariable String id) {
        return musicService.getSongById(id);
    }

    @GetMapping("/song/{keyword}/{id}")
    public Result<Song> getSongByKeywordAndId(@PathVariable String keyword, @PathVariable String id) {
        return musicService.getSongByKeywordAndId(keyword, id);
    }

    @GetMapping("/search/{keyword}")
    public Result<List<Song>> searchSongs(@PathVariable String keyword) {
        return musicService.searchSongs(keyword);
    }
}
